microxanox_version_here <- "0.9.1"
microxanox_version_path <- paste0("microxanox_v", microxanox_version_here)
if (packageVersion("microxanox") < package_version(microxanox_version_here)) {
  stop(paste0("microxanox version needs to be at least ", microxanox_version_here))
}
print(paste0("Version of microxanox: ", microxanox_version_here))
## [1] "Version of microxanox: 0.9.1"
wait_time <- "1e+05"
ss_9s <- readRDS(here::here("data",
                            microxanox_version_path, 
                            "temporal_method",
                            "event_definition_2",
                            paste0("ss_data_9strains_waittime", wait_time, "_event_definition_2.RDS")))



max_CB_var_gmax <- max(ss_9s$CB_var_gmax_s)
max_SB_var_gmax <- max(ss_9s$SB_var_gmax_s)
max_PB_var_gmax <- max(ss_9s$PB_var_gmax_s)

ss_9s <- ss_9s %>%
  mutate(standvar_CB_gmax = CB_var_gmax_s / max_CB_var_gmax,
         standvar_SB_gmax = SB_var_gmax_s / max_SB_var_gmax,
         standvar_PB_gmax = PB_var_gmax_s / max_PB_var_gmax)

1 CB

this_dat <- ss_9s %>%
  filter(
    SB_var_gmax_s == 0,
    PB_var_gmax_s == 0
  )
this_dat <- this_dat[order(this_dat$CB_var_gmax_s), ]

for(i in 1:20) {
  print(paste0("Standardised level of variation = ", round(this_dat$standvar_CB_gmax[i],2)))
  print(fig_state_vs_o2diff_sidebyside_alternative(this_dat[i,]))
}
## [1] "Standardised level of variation = 0"

## [1] "Standardised level of variation = 0.05"

## [1] "Standardised level of variation = 0.11"

## [1] "Standardised level of variation = 0.16"

## [1] "Standardised level of variation = 0.21"

## [1] "Standardised level of variation = 0.26"

## [1] "Standardised level of variation = 0.32"

## [1] "Standardised level of variation = 0.37"

## [1] "Standardised level of variation = 0.42"

## [1] "Standardised level of variation = 0.47"

## [1] "Standardised level of variation = 0.53"

## [1] "Standardised level of variation = 0.58"

## [1] "Standardised level of variation = 0.63"

## [1] "Standardised level of variation = 0.68"

## [1] "Standardised level of variation = 0.74"

## [1] "Standardised level of variation = 0.79"

## [1] "Standardised level of variation = 0.84"

## [1] "Standardised level of variation = 0.89"

## [1] "Standardised level of variation = 0.95"

## [1] "Standardised level of variation = 1"

#fig_state_vs_o2diff(only_SB_variable[13,])

2 SB

this_dat <- ss_9s %>%
  filter(
    CB_var_gmax_s == 0,
    PB_var_gmax_s == 0
  )
this_dat <- this_dat[order(this_dat$SB_var_gmax_s), ]

for(i in 1:20) {
  print(paste0("Standardised level of variation = ", round(this_dat$standvar_SB_gmax[i],2)))
  print(fig_state_vs_o2diff_sidebyside_alternative(this_dat[i,]))
}
## [1] "Standardised level of variation = 0"

## [1] "Standardised level of variation = 0.05"

## [1] "Standardised level of variation = 0.11"

## [1] "Standardised level of variation = 0.16"

## [1] "Standardised level of variation = 0.21"

## [1] "Standardised level of variation = 0.26"

## [1] "Standardised level of variation = 0.32"

## [1] "Standardised level of variation = 0.37"

## [1] "Standardised level of variation = 0.42"

## [1] "Standardised level of variation = 0.47"

## [1] "Standardised level of variation = 0.53"

## [1] "Standardised level of variation = 0.58"

## [1] "Standardised level of variation = 0.63"

## [1] "Standardised level of variation = 0.68"

## [1] "Standardised level of variation = 0.74"

## [1] "Standardised level of variation = 0.79"

## [1] "Standardised level of variation = 0.84"

## [1] "Standardised level of variation = 0.89"

## [1] "Standardised level of variation = 0.95"

## [1] "Standardised level of variation = 1"

#fig_state_vs_o2diff(only_SB_variable[13,])

3 PB

this_dat <- ss_9s %>%
  filter(
    CB_var_gmax_s == 0,
    SB_var_gmax_s == 0
  )
this_dat <- this_dat[order(this_dat$PB_var_gmax_s), ]

for(i in 1:20) {
  print(paste0("Standardised level of variation = ", round(this_dat$standvar_PB_gmax[i],2)))
  print(fig_state_vs_o2diff_sidebyside_alternative(this_dat[i,]))
}
## [1] "Standardised level of variation = 0"

## [1] "Standardised level of variation = 0.05"

## [1] "Standardised level of variation = 0.11"

## [1] "Standardised level of variation = 0.16"

## [1] "Standardised level of variation = 0.21"

## [1] "Standardised level of variation = 0.26"

## [1] "Standardised level of variation = 0.32"

## [1] "Standardised level of variation = 0.37"

## [1] "Standardised level of variation = 0.42"

## [1] "Standardised level of variation = 0.47"

## [1] "Standardised level of variation = 0.53"

## [1] "Standardised level of variation = 0.58"

## [1] "Standardised level of variation = 0.63"

## [1] "Standardised level of variation = 0.68"

## [1] "Standardised level of variation = 0.74"

## [1] "Standardised level of variation = 0.79"

## [1] "Standardised level of variation = 0.84"

## [1] "Standardised level of variation = 0.89"

## [1] "Standardised level of variation = 0.95"

## [1] "Standardised level of variation = 1"

#fig_state_vs_o2diff(only_SB_variable[13,])

4 CB-SB

this_dat <- ss_9s %>%
  filter(
    PB_var_gmax_s == 0,
    abs(standvar_CB_gmax - standvar_SB_gmax) < 0.00001
  )
this_dat <- this_dat[order(this_dat$CB_var_gmax_s), ]

for(i in 1:20) {
  print(paste0("Standardised level of variation = ", round(this_dat$standvar_CB_gmax[i],2)))
  print(fig_state_vs_o2diff_sidebyside_alternative(this_dat[i,]))
}
## [1] "Standardised level of variation = 0"

## [1] "Standardised level of variation = 0.05"

## [1] "Standardised level of variation = 0.11"

## [1] "Standardised level of variation = 0.16"

## [1] "Standardised level of variation = 0.21"

## [1] "Standardised level of variation = 0.26"

## [1] "Standardised level of variation = 0.32"

## [1] "Standardised level of variation = 0.37"

## [1] "Standardised level of variation = 0.42"

## [1] "Standardised level of variation = 0.47"

## [1] "Standardised level of variation = 0.53"

## [1] "Standardised level of variation = 0.58"

## [1] "Standardised level of variation = 0.63"

## [1] "Standardised level of variation = 0.68"

## [1] "Standardised level of variation = 0.74"

## [1] "Standardised level of variation = 0.79"

## [1] "Standardised level of variation = 0.84"

## [1] "Standardised level of variation = 0.89"

## [1] "Standardised level of variation = 0.95"

## [1] "Standardised level of variation = 1"

#fig_state_vs_o2diff(only_SB_variable[13,])

5 CB-PB

this_dat <- ss_9s %>%
  filter(
    SB_var_gmax_s == 0,
    abs(standvar_CB_gmax - standvar_PB_gmax) < 0.00001
  )
this_dat <- this_dat[order(this_dat$CB_var_gmax_s), ]

for(i in 1:20) {
  print(paste0("Standardised level of variation = ", round(this_dat$standvar_CB_gmax[i],2)))
  print(fig_state_vs_o2diff_sidebyside_alternative(this_dat[i,]))
}
## [1] "Standardised level of variation = 0"

## [1] "Standardised level of variation = 0.05"

## [1] "Standardised level of variation = 0.11"

## [1] "Standardised level of variation = 0.16"

## [1] "Standardised level of variation = 0.21"

## [1] "Standardised level of variation = 0.26"

## [1] "Standardised level of variation = 0.32"

## [1] "Standardised level of variation = 0.37"

## [1] "Standardised level of variation = 0.42"

## [1] "Standardised level of variation = 0.47"

## [1] "Standardised level of variation = 0.53"

## [1] "Standardised level of variation = 0.58"

## [1] "Standardised level of variation = 0.63"

## [1] "Standardised level of variation = 0.68"

## [1] "Standardised level of variation = 0.74"

## [1] "Standardised level of variation = 0.79"

## [1] "Standardised level of variation = 0.84"

## [1] "Standardised level of variation = 0.89"

## [1] "Standardised level of variation = 0.95"

## [1] "Standardised level of variation = 1"

#fig_state_vs_o2diff(only_SB_variable[13,])

6 SB-PB

this_dat <- ss_9s %>%
  filter(
    CB_var_gmax_s == 0,
    abs(standvar_SB_gmax - standvar_PB_gmax) < 0.00001
  )
this_dat <- this_dat[order(this_dat$SB_var_gmax_s), ]

for(i in 1:20) {
  print(paste0("Standardised level of variation = ", round(this_dat$standvar_SB_gmax[i],2)))
  print(fig_state_vs_o2diff_sidebyside_alternative(this_dat[i,]))
}
## [1] "Standardised level of variation = 0"

## [1] "Standardised level of variation = 0.05"

## [1] "Standardised level of variation = 0.11"

## [1] "Standardised level of variation = 0.16"

## [1] "Standardised level of variation = 0.21"

## [1] "Standardised level of variation = 0.26"

## [1] "Standardised level of variation = 0.32"

## [1] "Standardised level of variation = 0.37"

## [1] "Standardised level of variation = 0.42"

## [1] "Standardised level of variation = 0.47"

## [1] "Standardised level of variation = 0.53"

## [1] "Standardised level of variation = 0.58"

## [1] "Standardised level of variation = 0.63"

## [1] "Standardised level of variation = 0.68"

## [1] "Standardised level of variation = 0.74"

## [1] "Standardised level of variation = 0.79"

## [1] "Standardised level of variation = 0.84"

## [1] "Standardised level of variation = 0.89"

## [1] "Standardised level of variation = 0.95"

## [1] "Standardised level of variation = 1"

#fig_state_vs_o2diff(only_SB_variable[13,])

7 CB-SB-PB

this_dat <- ss_9s %>%
  filter(
    abs(standvar_CB_gmax - standvar_SB_gmax) < 0.00001,
    abs(standvar_SB_gmax - standvar_PB_gmax) < 0.00001
  )
this_dat <- this_dat[order(this_dat$SB_var_gmax_s), ]

for(i in 1:20) {
  print(paste0("Standardised level of variation = ", round(this_dat$standvar_CB_gmax[i],2)))
  print(fig_state_vs_o2diff_sidebyside_alternative(this_dat[i,]))
}
## [1] "Standardised level of variation = 0"

## [1] "Standardised level of variation = 0.05"

## [1] "Standardised level of variation = 0.11"

## [1] "Standardised level of variation = 0.16"

## [1] "Standardised level of variation = 0.21"

## [1] "Standardised level of variation = 0.26"

## [1] "Standardised level of variation = 0.32"

## [1] "Standardised level of variation = 0.37"

## [1] "Standardised level of variation = 0.42"

## [1] "Standardised level of variation = 0.47"

## [1] "Standardised level of variation = 0.53"

## [1] "Standardised level of variation = 0.58"

## [1] "Standardised level of variation = 0.63"

## [1] "Standardised level of variation = 0.68"

## [1] "Standardised level of variation = 0.74"

## [1] "Standardised level of variation = 0.79"

## [1] "Standardised level of variation = 0.84"

## [1] "Standardised level of variation = 0.89"

## [1] "Standardised level of variation = 0.95"

## [1] "Standardised level of variation = 1"

#fig_state_vs_o2diff(only_SB_variable[13,])